<?php

namespace app\app\controller;

use app\BaseController;
use app\app\model\ProjectTowerModel;

class map extends BaseController
{
    public function list()
    {
        $flag = input('flag');
        $page_size = input('pageSize', '1000');
        $projectName = input('projectName');
        $map[] = ['project_name', 'like', '%' . $projectName . '%'];
        $map[] = ['project_type', '=', $flag];
        $list = ProjectTowerModel::where($map)->order('t_no asc')->paginate($page_size);
        $this->success('success', $list);
    }

    public function info()
    {
        $id = input('id', '');
        $res = ProjectTowerModel::find($id);
        $this->success('success', $res);
    }


    public function update()
    {
        $id = input('id', '');
        $latitude = input('latitude');
        $longitude = input('longitude');
        if (empty($latitude) || empty($longitude)) {
            $this->error('未传必要参数');
        }
        $info = ProjectTowerModel::find($id);
        $info->latitude = $latitude;
        $info->longitude = $longitude;
        $info->save();
        $this->success('success');
    }
}
